package Models;

import DB.DBLocation;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;

public class Route extends DB.RowAbstract
{
	private int routeNo;
	private ArrayList<Location> locations;

	public Route()
	{}

	public void importData(ResultSet data) throws SQLException
	{
		this.setRouteNo(data.getInt("routeNo"));

	}

	private void fetchDependentData()
	{
		DBLocation dbl = new DBLocation();
		this.setLocations(dbl.fetchAll("routeNo = "+routeNo, "zipCode ASC", 0));
	}

	public static String[] getSearchColumns()
	{
		return new String[] { "routeNo" };
	}

	public ArrayList<Location> getLocations()
	{
		return locations;
	}

	public void setLocations(ArrayList<Location> locations)
	{
		this.locations = locations;
	}

	public int getRouteNo()
	{
		return routeNo;
	}

	public void setRouteNo(int routeNo)
	{
		this.routeNo = routeNo;
	}
}